<template>
	<view class="mainbgc">
		<view class="center">
			<view class="flexleft nav" @click="shangpin">
				<image src="/static/images/my/commodity.png" mode="" class="img"></image>
				<view class="textcenter word">商城管理</view>
			</view>
			<!-- <view class="flexleft section" @click="fabu">
				<image src="/static/images/my/fabu.png" mode="" class="img"></image>
				<view class="textcenter word">发布论坛</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				userInfo: {},
				setmsg: {}
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			getsetmsg() {
				httpRequest.request('/api/index/getConfigInfo', 'POST', {}, false, false, true).then(res => {
					if (res.code == 1) {
						this.setmsg = res.data
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			init() {
				httpRequest.request('/api/user/index', 'POST', {}, false, false, true).then(res => {
					if (res.code == 1) {
						this.userInfo = res.data
						this.getsetmsg()
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			fabu() {
				if (this.setmsg.goods_status == 0) {
					if (this.userInfo.shop_apply_status == 0) {
						httpRequest.toast("您还未进行企业认证，暂时无法发布商品");
						return false
					}
					if (this.userInfo.shop_apply_status == 1) {
						httpRequest.toast("您的企业认证正在审核中，暂时无法发布商品");
						return false
					}
					if (this.userInfo.shop_apply_status == 3) {
						httpRequest.toast("您的企业认证被拒，请重新进行认证");
						return false
					}
				}
				uni.navigateTo({
					url: '/pages/release/fabuluntan'
				})
			},
			shangpin() { //商品管理
				if (this.setmsg.forum_status == 0) {
					if (this.userInfo.shop_apply_status == 0) {
						httpRequest.toast("您还未进行企业认证，暂时无法发布论坛");
						return false
					}
					if (this.userInfo.shop_apply_status == 1) {
						httpRequest.toast("您的企业认证正在审核中，暂时无法发布论坛");
						return false
					}
					if (this.userInfo.shop_apply_status == 3) {
						httpRequest.toast("您的企业认证被拒，请重新进行认证");
						return false
					}
				}
				uni.navigateTo({
					url: '/pages/mypage/shangpingl'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.center {
		padding: 30rpx 30rpx;
	}

	.img {
		width: 31rpx;
		height: 31rpx;
		margin-right: 10rpx;
	}

	.nav {
		padding: 42rpx 254rpx;
		background: RGBA(244, 246, 250, 1);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.section {
		margin-top: 30rpx;
		padding: 42rpx 254rpx;
		background: RGBA(250, 245, 237, 1);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.word {
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #000000;
	}
</style>